import React, { Component } from 'react';
import { connect } from 'dva';
import Three3DBall from '@/components/Three3DBall';

@connect(({ commonModel }) => ({ ...commonModel }))
class ThreeDemo extends Component {
  componentDidMount() {
    this.fetch();
  }

  fetch = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'commonModel/query',
      targetKey: 'three3DBall',
      payload: { count: 100 },
    });
  };

  onBallCardClick = id => {
    console.log('id=', id);
  };

  render() {
    const { three3DBall = [] } = this.props;
    /* 可传入width、height，单位为像素 */
    return <Three3DBall originalData={three3DBall} onClick={this.onBallCardClick} />;
  }
}

export default ThreeDemo;
